<script>
import Aside from "@/components/Aside.vue";
import Header from "@/components/Header.vue";
import axios from 'axios';

export default {
  components: {Header, Aside},
  data() {
    return {
      iscollapse: false, // 修改为false，初始为展开状态
      aside_width: '200px'
    }
  },
  methods: {
    docollapse() {
      this.iscollapse = !this.iscollapse;
      this.aside_width = this.iscollapse ? '64px' : '200px'; // 动态设置宽度
    }
  },
  beforeCreate() {
    this.axios = axios;
  }
};
</script>

<template>
  <el-container style="height: 100%; border: 1px solid #eee">
    <!-- 侧边栏 -->
    <el-aside :width="aside_width" style="background-color: rgb(238,241,246); height: 100%; margin-left: -1px; transition: width 0.3s ease">
      <Aside :iscollapse="iscollapse" />
    </el-aside>

    <!-- 主容器 -->
    <el-container style="height: 100%">
      <!-- 标题头 -->
      <el-header height="100%" style="text-align: right; font-size: 12px;">
        <Header @docollapse="docollapse" :iscollapse="iscollapse" />
      </el-header>

      <!-- 主界面 -->
      <el-main style="height: 100%">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<style scoped>


</style>